package com.qf.zyh.web.controller;

import com.qf.zyh.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/user")
public class UserController {

    @RequestMapping("/login")
    public String login(String name,String pwd){
        if (name.equals("zs")&&pwd.equals("123")){
            return "forward:getall";
        }
        return "login";
    }
    @RequestMapping("/getall")
    public String getall(Model model){
        List<User> userList = new ArrayList<>();
        userList.add(new User(1,"zs","123456","男",8000.0));
        userList.add(new User(2,"ls","123456","男",8000.0));
        userList.add(new User(3,"ww","123456","男",8000.0));
        userList.add(new User(4,"zl","123456","男",8000.0));
        userList.add(new User(5,"mq","123456","男",8000.0));
        model.addAttribute("userList",userList);
        return "index";
    }

}
